<!DOCTYPE html>
<html>
<head>
    <title>Digital Transmission Block Diagram</title>
</head>
<body>
    <canvas id="physicsCanvas" width="850" height="250"></canvas>
    <script>
        const canvas = document.getElementById('physicsCanvas');
        const ctx = canvas.getContext('2d');

        // General Style Settings
        ctx.lineWidth = 2;
        ctx.strokeStyle = 'black';
        ctx.fillStyle = 'black';
        ctx.font = 'bold 24px sans-serif';
        ctx.textAlign = 'center';
        ctx.textBaseline = 'middle';

        // --- Component Coordinates and Dimensions ---
        const y_center = 100;
        const component_height = 50; // For amplifiers and boxes
        const box_width = 100;
        const amp_width = 50;
        const mic_radius = 18;

        let current_x = 60;

        // 1. Microphone
        // Vertical Bar
        ctx.beginPath();
        ctx.moveTo(current_x, y_center - mic_radius);
        ctx.lineTo(current_x, y_center + mic_radius);
        ctx.stroke();
        // Circle
        current_x += mic_radius + 5;
        ctx.beginPath();
        ctx.arc(current_x, y_center, mic_radius, 0, 2 * Math.PI);
        ctx.stroke();
        
        let x_start_line = current_x + mic_radius;
        current_x += mic_radius + 20;

        // 2. Amplifier 1
        let amp1_x_start = current_x;
        let amp1_x_end = amp1_x_start + amp_width;
        // Line to amplifier
        ctx.beginPath();
        ctx.moveTo(x_start_line, y_center);
        ctx.lineTo(amp1_x_start, y_center);
        ctx.stroke();
        // Amplifier triangle
        ctx.beginPath();
        ctx.moveTo(amp1_x_start, y_center - component_height / 2);
        ctx.lineTo(amp1_x_start, y_center + component_height / 2);
        ctx.lineTo(amp1_x_end, y_center);
        ctx.closePath();
        ctx.stroke();
        
        x_start_line = amp1_x_end;
        current_x = amp1_x_end + 30;

        // 3. Point P and line to ADC
        const p_x = current_x;
        current_x += 40;
        const adc_x_start = current_x;
        // Line
        ctx.beginPath();
        ctx.moveTo(x_start_line, y_center);
        ctx.lineTo(adc_x_start, y_center);
        ctx.stroke();
        // Point P dot
        ctx.beginPath();
        ctx.arc(p_x, y_center, 3.5, 0, 2 * Math.PI);
        ctx.fill();
        // Point P label
        ctx.font = 'bold 24px sans-serif';
        ctx.fillText('P', p_x, y_center + 25);
        
        // 4. ADC Block
        const adc_x_end = adc_x_start + box_width;
        ctx.strokeRect(adc_x_start, y_center - component_height / 2, box_width, component_height);
        ctx.font = 'bold 26px sans-serif';
        ctx.fillText('ADC', adc_x_start + box_width / 2, y_center);
        
        x_start_line = adc_x_end;
        current_x = adc_x_end + 180; // Long dashed line for transmission

        // 5. Dashed line and DAC Block
        const dac_x_start = current_x;
        ctx.beginPath();
        ctx.setLineDash([8, 8]);
        ctx.moveTo(x_start_line, y_center);
        ctx.lineTo(dac_x_start, y_center);
        ctx.stroke();
        ctx.setLineDash([]); // Reset to solid line

        const dac_x_end = dac_x_start + box_width;
        ctx.strokeRect(dac_x_start, y_center - component_height / 2, box_width, component_height);
        ctx.font = 'bold 26px sans-serif';
        ctx.fillText('DAC', dac_x_start + box_width / 2, y_center);

        x_start_line = dac_x_end;
        current_x = dac_x_end + 30;

        // 6. Amplifier 2
        let amp2_x_start = current_x;
        let amp2_x_end = amp2_x_start + amp_width;
        // Line to amplifier
        ctx.beginPath();
        ctx.moveTo(x_start_line, y_center);
        ctx.lineTo(amp2_x_start, y_center);
        ctx.stroke();
        // Amplifier triangle
        ctx.beginPath();
        ctx.moveTo(amp2_x_start, y_center - component_height / 2);
        ctx.lineTo(amp2_x_start, y_center + component_height / 2);
        ctx.lineTo(amp2_x_end, y_center);
        ctx.closePath();
        ctx.stroke();
        
        x_start_line = amp2_x_end;
        current_x = amp2_x_end + 30;

        // 7. Speaker
        const speaker_x_start = current_x;
        // Line to speaker
        ctx.beginPath();
        ctx.moveTo(x_start_line, y_center);
        ctx.lineTo(speaker_x_start, y_center);
        ctx.stroke();
        
        // Speaker body
        const back_w = 12;
        const back_h = 24;
        const cone_w = 20;
        const cone_h = 40;
        ctx.beginPath();
        ctx.moveTo(speaker_x_start, y_center - back_h / 2); // Top-left of back
        ctx.lineTo(speaker_x_start + back_w, y_center - back_h / 2); // Top-right of back
        ctx.lineTo(speaker_x_start + back_w, y_center + back_h / 2); // Bottom-right of back
        ctx.lineTo(speaker_x_start, y_center + back_h / 2); // Bottom-left of back
        ctx.closePath();
        // Cone part
        ctx.moveTo(speaker_x_start + back_w, y_center - back_h / 2);
        ctx.lineTo(speaker_x_start + back_w + cone_w, y_center - cone_h / 2); 
        ctx.lineTo(speaker_x_start + back_w + cone_w, y_center + cone_h / 2); 
        ctx.lineTo(speaker_x_start + back_w, y_center + back_h / 2);
        ctx.stroke();

        // 8. Figure Label
        ctx.font = 'bold 24px sans-serif';
        ctx.fillText('Fig. 6.1', canvas.width / 2, canvas.height - 30);
    </script>
</body>
</html>